{
  "properties" : { },
  "id" : "94cb041af0644eb6b7306988bfd060eb",
  "script" : null,
  "groupId" : "43da313fdeaa495798cf783e6cf83479",
  "name" : "查询左侧树结构",
  "createTime" : 1727070857019,
  "updateTime" : 1726046135981,
  "lock" : "1",
  "createBy" : "ndmp",
  "updateBy" : "ndmp",
  "path" : "queryTree",
  "method" : "GET",
  "parameters" : [ ],
  "options" : [ ],
  "requestBody" : "",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"status\": 200,\n    \"message\": \"success\",\n    \"data\": [\n        {\n            \"id\": \"cba03f89025a42f9bf6a3c191eaed231\",\n            \"parentId\": \"9999\",\n            \"weight\": \"9999\",\n            \"name\": \"陕西\",\n            \"children\": [\n                {\n                    \"id\": \"65f0f3f40aed43f29fe7ea7a46e9e714\",\n                    \"parentId\": \"cba03f89025a42f9bf6a3c191eaed231\",\n                    \"weight\": \"9999\",\n                    \"name\": \"750延安（洛川）变\"\n                },\n                {\n                    \"id\": \"32299273e10e45d28c135818fc47a18e\",\n                    \"parentId\": \"cba03f89025a42f9bf6a3c191eaed231\",\n                    \"weight\": \"9999\",\n                    \"name\": \"朔方变\"\n                },\n                {\n                    \"id\": \"2591d85f8cc24976806f7340a08a3505\",\n                    \"parentId\": \"cba03f89025a42f9bf6a3c191eaed231\",\n                    \"weight\": \"9999\",\n                    \"name\": \"榆林变\"\n                },\n                {\n                    \"id\": \"ee80e6d3974248579427b9edb065a327\",\n                    \"parentId\": \"cba03f89025a42f9bf6a3c191eaed231\",\n                    \"weight\": \"9999\",\n                    \"name\": \"硖石变\"\n                },\n                {\n                    \"id\": \"c96c2fefc57847b4a4d56869a10cbd1b\",\n                    \"parentId\": \"cba03f89025a42f9bf6a3c191eaed231\",\n                    \"weight\": \"9999\",\n                    \"name\": \"定靖（夏州）变\"\n                },\n                {\n                    \"id\": \"fc14d1f63a9743dab9803cde81de6026\",\n                    \"parentId\": \"cba03f89025a42f9bf6a3c191eaed231\",\n                    \"weight\": \"9999\",\n                    \"name\": \"750信义变\"\n                },\n                {\n                    \"id\": \"aa4454ea3eff4569891d69feee5b620c\",\n                    \"parentId\": \"cba03f89025a42f9bf6a3c191eaed231\",\n                    \"weight\": \"9999\",\n                    \"name\": \"西安北（泾渭）\"\n                },\n                {\n                    \"id\": \"225cf9838be34385b2e5adee46be9200\",\n                    \"parentId\": \"cba03f89025a42f9bf6a3c191eaed231\",\n                    \"weight\": \"9999\",\n                    \"name\": \"鹤城变\"\n                },\n                {\n                    \"id\": \"04fc543165284bf28a0c049b9e0d1215\",\n                    \"parentId\": \"cba03f89025a42f9bf6a3c191eaed231\",\n                    \"weight\": \"9999\",\n                    \"name\": \"南山变汇聚\"\n                },\n                {\n                    \"id\": \"ea54c9fdc94c493b8a9862265d94b8ac\",\n                    \"parentId\": \"cba03f89025a42f9bf6a3c191eaed231\",\n                    \"weight\": \"9999\",\n                    \"name\": \"榆横变\"\n                },\n                {\n                    \"id\": \"17c50e20a847428c8be35605a50e7f24\",\n                    \"parentId\": \"cba03f89025a42f9bf6a3c191eaed231\",\n                    \"weight\": \"9999\",\n                    \"name\": \"大杨变\"\n                },\n                {\n                    \"id\": \"34fd3efd75c44698a38ce016861b2c6f\",\n                    \"parentId\": \"cba03f89025a42f9bf6a3c191eaed231\",\n                    \"weight\": \"9999\",\n                    \"name\": \"东郊变\"\n                },\n                {\n                    \"id\": \"8ad48cda63d342fd9d35fcdca7661fbf\",\n                    \"parentId\": \"cba03f89025a42f9bf6a3c191eaed231\",\n                    \"weight\": \"9999\",\n                    \"name\": \"汉中变\"\n                }\n            ]\n        }\n    ]\n}",
  "description" : "",
  "requestBodyDefinition" : {
    "name" : null,
    "value" : null,
    "description" : null,
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  },
  "responseBodyDefinition" : {
    "name" : null,
    "value" : null,
    "description" : null,
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  }
}
================================
import cn.hutool.core.collection.CollUtil
import java.lang.reflect.Array
import java.util.ArrayList;
import java.util.List;
import cn.hutool.core.lang.tree.TreeUtil
import cn.hutool.core.lang.tree.TreeNode
import java.math.BigDecimal
import redis

var token = header.get("blade-auth")::string;
var dccId = redis.get(token.substring(7))

var sql = """
     SELECT *
        FROM ndmp_ip_group  where dcc_id=#{dccId}
        ORDER BY lv
    """
var list = db.select(sql)
// 构建node列表
List nodeList = CollUtil.newArrayList();
list.map(r -> {
    nodeList.add(new TreeNode(r.id, r.parentId,r.groupName,"9999") )
})
List treeList = TreeUtil.build(nodeList, "9999");
return treeList;
